package com.imooc.ecommerce.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义异常类
 * @author zhangshao
 * @since 2023/12/25 21:29
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class BizException extends RuntimeException {

    private String errorCode;

    private String errorMessage;

    public BizException(){
        super();
    }

    public BizException(BaseErrorInfo errorInfo){
        super(errorInfo.getErrorCode());
        this.errorCode = errorInfo.getErrorCode();
        this.errorMessage = errorInfo.getErrorMessage();
    }

    public BizException(BaseErrorInfo errorInfo,Throwable cause){

        super(errorInfo.getErrorCode(),cause);
        this.errorCode = errorInfo.getErrorCode();
        this.errorMessage = errorInfo.getErrorMessage();
    }

}


